import React,{useReducer} from "react";
import { Layout,Divider } from "antd";
import { SideBar } from "../../components";

import Navigation from "../../components/Mycompon/Navigation";
import SearchOne from "../../components/Mycompon/SearchOne";
import LabelPage from "../../components/Mycompon/LabelPage";
import DrawerCom from "../../components/Mycompon/Drawer";

const { Header, Content, Sider } = Layout;

let initialState = {
  user: { id: 1, name: 'Lisi' },
  friends: ['LiLei', 'HanMeiMei'],
  typeNames:[],
  monodrome:'' //单值查询
};



const reducer = (state, action) => {


  switch (action.type) {
    case 'addFriends':
      return {
        ...state,
        friends: [...state.friends, action.name],
      };
    case 'modifyName':
      return {
        ...state,
        user: { ...state.user, name: action.name },
      };
  
    case 'ADDtypeName':
      return {
        ...state,
        typeNames:action.name

      };
      case 'MDquery':
        return {
          ...state,
          monodrome:action.md  
  
        };
}
}


export default  function Home() {

  const [store, dispatch] = useReducer(reducer, initialState);
  // const { children, location } = props;

  return (
    <>
    {/* <DrawerCom/> */}
 
      <Layout>
       
        
        <div style={{ background: "#fff", padding: "0 25px" ,
        margin:"10px 10px 0px 10px"
      }}>
          <div><Navigation store={store} dispatch={dispatch}/></div>
          <Divider/>
          <div>
          <SearchOne Navigation store={store} dispatch={dispatch}/>
          </div>
        </div>
        
        
        <Content style={{ margin: "15px"}}>
         
        <LabelPage store={store} dispatch={dispatch}/>
        </Content>
      </Layout>
    

    </>
  );
}

